//获取工作台
(function($){
    //console.log($);
    $.ajax({
        url: "/platform",
        context: document.body,
        dataType: "html",
        success: function(msg){
            $(this).prepend(msg);
            d_h = $(document).height();
            $("#platform").height(d_h);
            $("#platform").after("<div id='arrowhead'><span><<</span></div>");
            $("#arrowhead span").css("top",d_h/2+'px');
            $("#platform").after("<div id='mask'></div>");
            $("#platform").data("open",true);
            arrowhead_click();
        }
    });
    $(window).resize(function(){
        d_h = $(document).height();
        $("#platform").height(d_h);
        $("#arrowhead span").css("top",d_h/2+'px');
    });

    function arrowhead_click(){
        $("#arrowhead").on('click',function(){
            if($("#platform").data("open") == true){
                $("#platform").animate({left:'-400px'});
                $("#arrowhead").animate({left:0});
                $("#arrowhead span").animate({left:'5px'});
                $("#arrowhead span").html(">>");
                $("#mask").fadeOut();
                $("#platform").data("open",false);
            }else{
                $("#platform").animate({left:0});
                $("#arrowhead").animate({left:'400px'});
                $("#arrowhead span").animate({left:'405px'});
                $("#arrowhead span").html("<<");
                $("#mask").fadeIn();
                $("#platform").data("open",true);
            }
        });
    }
})(jQuery);
